<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%
    //获取项目名
    String path = request.getContextPath();
    //获取tomcat 协议+地址+端口号+ 获取项目名
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    //获取tomcat 协议+地址+端口号
    String imgPath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/xmpic/";

%>
<html>
<head>
    <link rel="icon" href="../img/logo.jpg">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>商品信息</title>
    <link href="<%=basePath %>admin/css/style.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .tablelist th {
            text-align: center;
        }
    </style>
    <script type="text/javascript" src="<%=basePath %>js/jquery-3.3.1.js"></script>

    <script type="text/javascript">

        // old write
        $(document).ready(function(){
            $(".click").click(function(){
                $(".tip").fadeIn(200);
            });

            $(".tiptop a").click(function(){
                $(".tip").fadeOut(200);
            });

            $(".sure").click(function(){
                $(".tip").fadeOut(100);
            });

            $(".cancel").click(function(){
                $(".tip").fadeOut(100);
            });

        });
    </script>
</head>
<body>

<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">订单管理</a></li>
    </ul>
</div>
<div class="rightinfo">
    <div class="tools">
        <ul class="toolbar">
<%--            <li style="cursor: pointer;" onclick="add_goods()"><span><img src="<%=basePath %>admin/images/t01.png"  /></span>添加商品</li>--%>
            <li style="cursor: pointer;" onclick="toBatchDel()"><span><img src="<%=basePath %>admin/images/t03.png" /></span>批量删除</li>
        </ul>
    </div>

    <form id="f1" method="post" action="<%=basePath%>admin/batchDelOrders ">
        <table class="tablelist">
        <thead>
        <tr>
            <th><input name="" type="checkbox" value="" checked="checked"/></th>
            <th>序号<i class="sort"><img src="<%=basePath %>admin/images/px.gif" /></i></th>
            <th>订单号</th>
            <th>所属用户</th>
            <th>总价</th>
            <th>商品数量</th>
            <th>订单名称</th>
            <%--            <th width="10%">简介</th>--%>
            <%--            <th width="20%">详情</th>--%>
            <%--            <th>商品展示图</th>--%>
            <%--            <th>是否热推</th>--%>
            <%--            <th>型号</th>--%>
            <th>生成日期</th>
            <th>订单状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${orderspageinfo.list}" var="order" varStatus="i">
            <tr style="text-align: center;">
                <td><input class="one" name="ids" type="checkbox" value="${order.ordersNumber }" /></td>
                <td>${i.count }</td>
                <td>${order.ordersNumber }</td>
                <td>${order.uid }</td>
                <td>${order.sumPrice }</td>
                <td>${order.goodsCount }</td>
                <td>${order.ordersName }</td>
                    <%--                <td width="10%">${goods.description }</td>--%>
                    <%--                <td width="20%">${goods.full_description }</td>--%>
                    <%--                <td>--%>
                    <%--                    <img width="80" height="80" src="<%=imgPath %>${goods.pic }" />--%>
                    <%--                </td>--%>
                    <%--                <td>--%>
                    <%--                    <c:if test="${goods.state == 0 }">正常</c:if>--%>
                    <%--                    <c:if test="${goods.state == 1 }">热门产品</c:if>--%>
                    <%--                    <c:if test="${goods.state == 2 }">为你推荐</c:if>--%>
                    <%--                    <c:if test="${goods.state == 3 }">新品</c:if>--%>
                    <%--                    <c:if test="${goods.state == 4 }">小米明星单品</c:if>--%>
                    <%--                </td>--%>
                    <%--                <td>${goods.version }</td>--%>
                <td>
                    <fmt:formatDate value="${order.createTime }" pattern="yyyy-MM-dd HH:mm:ss" />
                </td>
                <td>
                        ${order.getstringState()}

                </td>
                <td>
                    <a style="color: green;" href="<%=basePath %>goods?func=findGoodsById&gid=${goods.gid }">修改</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    </form>

    <div class="pagin">
        <div class="message">
            共<i class="blue">${orderspageinfo.total }</i>条记录，
            当前显示第&nbsp;<i class="blue">${orderspageinfo.pageNum }&nbsp;</i>页
            共&nbsp;<i class="blue">${orderspageinfo.pages }&nbsp;</i>页
        </div>
        <ul class="paginList">
            <li class="paginItem"><a href="<%=basePath %>admin/imglist1?pageNum=1">首页</a></li>
            <li class="paginItem"><a href="<%=basePath %>admin/imglist1?pageNum=${orderspageinfo.prePage }">上一页</a></li>
            <li class="paginItem"><a href="<%=basePath %>admin/imglist1?pageNum=${orderspageinfo.nextPage }">下一页</a></li>
            <li class="paginItem"><a href="<%=basePath %>admin/imglist1?pageNum=${orderspageinfo.pages }">尾页</a></li>
        </ul>
    </div>
    <div class="tip">
        <div class="tiptop"><span>提示信息</span><a></a></div>
        <div class="tipinfo">
            <span><img src="images/ticon.png" /></span>
            <div class="tipright">
                <p>是否确认对信息的修改 ？</p>
                <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
            </div>
        </div>
        <div class="tipbtn">
            <input name="" type="button"  class="sure" value="确定" />&nbsp;
            <input name="" type="button"  class="cancel" value="取消" />
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
<script type="text/javascript">

    //点击添加商品的方法
    function add_goods(){
        /*
            我们此时应该请求商品的servlet，来调用分类的service、dao来得到商品分类数据
        */
        //window.location = "goods_add.jsp";
        window.location = "<%=basePath %>goods?func=findAllCate";
    }

    function toBatchDel() {
        let selectedIdLen =$("input[name='ids']:checked").length;
        if(selectedIdLen==0){
            alert("请选择要删除的记录。")
            return;
        }
        let sure =confirm("确定要删除你选择的记录吗？");
        if(sure)
            $("#f1").submit();
    }

</script>
</html>

















